package cn.net.cfss.fgbp.provider.manage.spi;

import cn.net.cfss.fgbp.base.service.FeignBaseService;
import cn.net.cfss.fgbp.provider.manage.biz.FscLogOperationBiz;
import cn.net.cfss.fgbp.spi.manage.constant.DeleteFlagEnum;
import cn.net.cfss.fgbp.spi.manage.dto.FscLogOperationDto;
import cn.net.cfss.fgbp.spi.manage.inte.IFscLogOperationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author wutao
 * @version 1.0
 * @date 2020/10/13 14:20
 */
@RestController
@Slf4j
public class FscLogOperationSpi extends FeignBaseService implements IFscLogOperationService {

    @Autowired
    private FscLogOperationBiz logOperationBiz;

    @Override
    public FscLogOperationDto add(FscLogOperationDto fscLogOperationDto) {
        fscLogOperationDto.setCreateBy(getUserId());
        fscLogOperationDto.setUpdateBy(getUserId());
        fscLogOperationDto.setCreateTime(new Date());
        fscLogOperationDto.setUpdateTime(new Date());
        fscLogOperationDto.setDeleteFlag(DeleteFlagEnum.NOT_DEL);
        fscLogOperationDto.setCreateByName(getUserName());
        fscLogOperationDto.setId(logOperationBiz.getUID());

        logOperationBiz.insertSelective(fscLogOperationDto);
        return fscLogOperationDto;
    }
}
